<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title>吉林旅游</title>
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<link rel="stylesheet" type="text/css" href="css/all_css.css" />
		<link rel="stylesheet" type="text/css" href="css/weui/base.css" />
		<link rel="stylesheet" type="text/css" href="lib/weui.css" />
		<link rel="stylesheet" type="text/css" href="css/weui/jquery-weui.css" />
		<link rel="stylesheet" type="text/css" href="iconfont/iconfont.css" />
		<style type="text/css">
			body {
				background-color: #F5F5F5;
			}
			
			.tour_main {
				max-width: 640px;
				min-width: 320px;
				margin: 0px auto;
			}
			
			.app_head_left {
				float: left;
				width: 30%;
				padding-top: 6px;
				padding-left: 6px;
			}
			
			.app_head_left a {
				color: #FFFFFF;
				font-size: 1.5em;
				font-weight: bold;
			}
			
			.app_head_mid {
				float: left;
				width: 40%;
				padding-top: 5px;
			}
			
			#app_head_title {
				text-align: center;
				color: #FFFFFF;
				font-size: 1.6em;
				font-family: "宋体";
				font-weight: bold;
				height: 100%;
			}
			/*#app_head_title img{
				width: 120%;
				height: 44px;
				position: relative;
				top: -5px;
				left: -10px;
			}*/
			
			.app_head_right {
				float: right;
				width: 30%;
				text-align: right;
				padding: 6px;
			}
			
			.app_head_right a {
				margin-right: -5px;
			}
			
			.app_head_right a img {
				width: 31px;
			}
			
			.tour_mid {
				padding-top: 70px;
			}
			
			.tour_mid img {
				width: 100%;
				margin-bottom: 8px;
				border-radius: 10px;
			}
			/*导航栏样式*/
			
			.weui_bar_item_on {
				background-color: #FFFFFF !important;
				color: #0070B4 !important;
			}
			
			.weui_navbar_item {
				color: #FFFFFF;
				background-color: #CCCCCC;
			}
			
			.weui_navbar_item b {
				display: block;
				font-size: 1.1em;
				height: 1.25em;
				line-height: 1.25em;
			}
			
			.weui_navbar {
				width: 100%;
			}
			/* 搜索框区域样式 */
			
			.sec_line {
				width: 100%;
				background-color: #F5F5F5;
				padding: 5px 0px 7px 0;
				/*border-bottom: 1px solid #DEDEDE;*/
			}
			
			#InputLine {
				margin-left: 2%;
				margin-right: 2%;
				width: 96%;
				border: 1px solid #DEDEDE;
				border-radius: 7px;
				height: 44px;
				background-color: #FFFFFF;
				opacity: 0.92;
			}
			
			#tour_suggestId {
				padding-left: 1em;
				width: 89%;
				height: 100%;
				border: none;
				outline: medium;
				border-radius: 5px;
				color: #969696;
				font-size: 1.15em;
				font-weight: bold;
			}
			
			#searchBtn {
				display: block;
				float: right;
				width: 8.5%;
				padding-right: 10px;
				color: #666666;
				font-size: 2em;
				text-align: right;
				position: relative;
				left: -5px;
			}
			/* ul li 列表样式 */
			
			#tourPlace_Ul {
				/*background-color: #FFFFFF;*/
			}
			
			#tourPlace_Ul li {
				color: #444444;
				padding: 10px;
				padding-left: 20px;
				font-weight: bold;
				height: 50px;
				line-height: 28px;
				font-size: 1.16em;
				border-bottom: 1px dashed #E8E8E8;
			}
			/*#tourPlace_Ul li:nth-child(2n) {
				color: #A3C6C8;
			}*/
			
			#noResult {
				width: 80%;
				margin-left: 10%;
				margin-right: 10%;	
				margin-top: 90px;
				color: #444444;
				font-size: 2em;
				text-align: center;
			}
			/* loading样式 */
			
			#loadingSFZ {
				width: 8%;
				margin-left: 46%;
				margin-right: 46%;
				margin-top: 90px;
			}
			/* 返回顶部按钮 */
			
			.returnTopBtn {
				position: fixed;
				right: 15px;
				bottom: 80px;
				width: 45px;
				height: 43px;
				border-radius: 8px;
				z-index: 9999;
				background-color: #CCCCCC;
				padding: 6px;
			}
			
			.weui_tab_bd {
				margin-top: -48px;
			}
			
			#bgImgDiv {
				width: 100%;
				position: fixed;
				bottom: 0px;
				background-image: url(img/bg/JLTour_bg.jpeg);
				background-repeat: no-repeat;
				background-size: 100% 100%;
				opacity: 0.6;
				/*max-width: 630px;
				min-width: 320px;
				margin: 0 auto;*/
			}
			
			/*底部提示框*/
			
			.foot_showMap {
				position: fixed;
				bottom: 0;
				height: 22%;
				box-shadow: 0px -3px 2px #999999;
				max-width: 640px;
				min-width: 320px;
				width: 100%;
				margin: 0px auto;
				background-image: url(img/show_map/bg_jingyue_bottom2.png);
				background-size: 100% 105%;
				background-repeat: no-repeat;
			}
		</style>
	</head>
	<script type="text/javascript" src="https://api.map.baidu.com/api?v=2.0&ak=MMh4H9m5FLBpizlht86GnGynuaM0oGKz"></script>

	<body ontouchstart>
		<div id="bgImgDiv"></div>
		<div class="tour_main">
			<div class="index_head">
				<div class="app_head_left">
					<a onclick="tourReturnBtn()" class="iconfont">&#xe6d4;</a>
				</div>
				<div class="app_head_mid">
					<p id="app_head_title">吉林旅游</p>
				</div>
				<div class="app_head_right">
					<a>
						<img src="img/tour/yjfxBtn.png" id="shareTourBtn" />
					</a>
				</div>
			</div>
			<div class="tour_mid">
				<div class="weui_tab">
					<!--选择步行公交自驾按钮区域-->
					<div class="weui_navbar" id="secTitle" style="display: none;">
						<a href="#tourPlace" id="tourPlaceBtn" class="weui_navbar_item weui_bar_item_on">
							<b>景点</b>
						</a>
						<a href="#tourMap" class="weui_navbar_item" id="tourMapBtn">
							<b>地图</b>
						</a>
					</div>
					<div class="weui_tab_bd">
						<div id="tourPlace" class="weui_tab_bd_item weui_tab_bd_item_active">
							<div class="sec_line">
								<div id="InputLine" style="margin-top: -1px;">
									<input type="text" id="tour_suggestId" maxlength="15" onpaste="return false;" placeholder="请输入景点名称" />
									<!--<a id="delBtn" href="javascript:;" class="iconfont" style="display: none;">&#xe60b;</a>-->
									<a id="searchBtn" href="javascript:;" class="iconfont">&#xe709;</a>
								</div>
							</div>
							<ul id="tourPlace_Ul">
								<!--DOM JS添加-->
							</ul>
							<img src="img/taxi/loading_icon_1.gif" id="loadingSFZ" style="display: none;" />
							<h1 id="noResult" style="display: none;">搜索无结果</h1>
						</div>
						<div id="tourMap" class="weui_tab_bd_item">
							<div id="allmap"></div>
						</div>
					</div>
				</div>
			</div>
		</div>
		<img src="img/index/returnTop2.png" style="display: none;" class="returnTopBtn" />
		<script src="js/jquery-1.11.0.js" type="text/javascript" charset="utf-8"></script>
		<script src="js/back_end.js" type="text/javascript" charset="utf-8"></script>
		<script src="js/md5.js" type="text/javascript" charset="utf-8"></script>
		<script src="js/weui/jquery-weui.js" type="text/javascript" charset="utf-8"></script>
		<script type="text/javascript">
			var map = new BMap.Map("allmap");
			$(function() {
				// 添加百度地图
				//				var loadCount = 1;
				//				map.addEventListener("tilesloaded", function() {
				//					if(loadCount == 1) {
				//
				//					}
				//					loadCount = loadCount + 1;
				//				});
				var point = new BMap.Point(125.23973333, 43.99094444); //地图加载时位于长春市中心点
				map.centerAndZoom(point, 12);
				var h = document.documentElement.clientHeight - 75;
				$("#allmap").height(h);
				$("#bgImgDiv").height(h + 5);
				$("#allmap").width(document.documentElement.clientWidth);
				getAllTour();
			});
			//判断滚动条是否在顶部 并显示返回顶部图标
			window.onscroll = function() {
				var scroll_top = $(document).scrollTop();
				if(scroll_top != 0) {
					$(".returnTopBtn").show();
				} else if(scroll_top == 0) {
					$(".returnTopBtn").hide();
				}
			}
			//每当点击地图按钮的时候，页面都返回顶部
			$("#chooseMap").click(function() {
				$(window).scrollTop(0);
			});
			$(".returnTopBtn").click(function() {
				//				$(window).scrollTop(0);
				$("body").animate({
					scrollTop: 0
				}, 300)
			});

			$(".weui_navbar_item").click(function() {
				$(window).scrollTop(0);
			});

			function getAllTour() {
				$.ajax({
					type: "post",
					url: Url,
					data: {
						"type": "tourism_info",
						"TNAME": $("#tour_suggestId").val()
					},
					async: false,
					cache: false,
					dataType: "jsonp", //数据类型为jsonp
					jsonp: "callbackparam", //服务端用于接收callback调用的function名的参数  
					jsonpCallback: "jsonpCallback1",
					success: function(data) {
						//						console.log(data.MSG);
						$("#noResult").hide();
						$("#loadingSFZ").hide();
						if(data.MSG == "成功") {
							var d = data.DATA;
							var m = data.MDATA;
							if(isEncrypt(d, m)) {
								//						console.log(data);
								d = eval(d);
								for(var i = 0; i < d.length; i++) {
									//循环添加DOM至ul中
									var li = $('<li data-dz="' + d[i].DZ + '" data-X="' + d[i].ZB.split(",")[0] + '" data-Y="' + d[i].ZB.split(",")[1] + '" onclick="jumpToTourMsg(this)">' + d[i].JQMC + '</li>');
									$("#tourPlace_Ul").append(li);
								}
							}else{
								errMD();
							}
						} else {
							$("#noResult").show();
						}
					},
					error: function(data) {
						$.alert("连接超时，请稍后再试", "提示");
					}
				});
			};
			//输入框输入信息触发事件
			var timeout;
			$("#tour_suggestId").keyup(function() {
				var linkName = $(this).val();
				var pattern = /^[\u4e00-\u9fa5]*$/;
				if(!pattern.test(linkName)) {
					$.alert("请输入中文", "提示", function() {
						$("#tour_suggestId").val("");
					});
				} else {
					$("#noResult").hide();
					//输入框内容为空时 ul中显示所有收费站名称
					$("#tourPlace_Ul").html(""); //清空所有li
					clearTimeout(timeout);
					timeout = setTimeout("tourInputTS()", 1000);
				}
			});

			//方法：输入框输入信息模糊查询
			function tourInputTS() {
				$("#loadingSFZ").show();
				$("#tourPlace_Ul").html(""); //清空所有li
				getAllTour();
			};
			//方法：点击每个li
			function jumpToTourMsg(t) {
				//跳转至地图区域
				$("#tourMapBtn").click();
				setTimeout(function() {
					//获取某个旅游景点信息
					map.clearOverlays(); //清除地图上所有覆盖物
					var address = $(t).attr("data-dz");
					var thisPoint = new BMap.Point($(t).attr("data-X"), $(t).attr("data-Y"));
					var marker = new BMap.Marker(thisPoint); // 创建标注
					map.addOverlay(marker); // 将标注添加到地图中
					var centerP = thisPoint;

					var opts = {
						width: 200, // 信息窗口宽度
						title: t.innerHTML, // 信息窗口标题
						enableMessage: true //设置允许信息窗发送短息
						//					message: ""
					}
					var infoWindow = new BMap.InfoWindow(address, opts); // 创建信息窗口对象
					marker.setOffset(new BMap.Size(4, 22)); //改变提示文本位置
					map.openInfoWindow(infoWindow, thisPoint); //页面跳转至地图区域自动开启信息窗口
					marker.addEventListener("click", function() {
						map.openInfoWindow(infoWindow, thisPoint); //开启信息窗口
					});
					map.setCenter(centerP);
					//				map.enableInertialDragging(); //开启惯性拖拽
				}, 500);

			};

			//返回按钮
			function tourReturnBtn() {
				if($("#tourMapBtn").hasClass("weui_bar_item_on")) {
					$("#tourPlaceBtn").click();
				} else {
					window.location.href = "javascript:history.go(-1)";
				}
			}

			//跳转至游记分享 按钮 事件
			$("#shareTourBtn").click(function() {
				if(localStorage.userJson) { //判断是否登录
					window.location.href = "tour_share.html";
				} else {
					$.confirm("进入游记分享请您先登录", function() {
						//点击确认后的回调函数
						window.location.href = "Login.html";
					}, function() {
						//点击取消后的回调函数
					});
				}
			});
		</script>
	</body>

</html>